using HMCollada.Core;
using System.Xml;
namespace HMCollada.Core {
    internal struct HMColladaImage {
        internal string id;
        internal string name;
        internal string format;
        internal int hieght;
        internal int width;
        internal int depth;
        internal HMColladaAsset asset;
        internal string init_from;
    }
}

namespace HMCollada {
    internal partial class HMColladaLoader {
        private static HMColladaImage LoadImage() {
            HMColladaImage newImage = new HMColladaImage();
            newImage.id = colladaReader.GetAttribute("id");
            newImage.name = colladaReader.GetAttribute("name");
            newImage.format = colladaReader.GetAttribute("format");
            newImage.hieght = int.Parse(colladaReader.GetAttribute("height"));
            newImage.width = int.Parse(colladaReader.GetAttribute("width"));
            newImage.depth = int.Parse(colladaReader.GetAttribute("depth"));

            if (!colladaReader.IsEmptyElement) colladaReader.Read();
            do {
                if (colladaReader.NodeType != XmlNodeType.EndElement) {
                    switch (colladaReader.Name) {
                        case "asset": newImage.asset = LoadAsset(); break;
                        case "init_from": newImage.init_from = ReadString().Trim(); break;
                    }
                }

                if (!colladaReader.IsEmptyElement) colladaReader.Read();
            } while (colladaReader.Name != "image");

            if (colladaReader.IsEmptyElement) colladaReader.Read();
            return newImage;
        }
    }
}